package com.vegetable.modules.entity.finance;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 支付日志
 * </p>
 *
 * @author Qoder
 * @since 2025-04-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("payment_log")
@ApiModel(value = "PaymentLog对象", description = "支付日志")
public class PaymentLog extends BaseEntity {

    @ApiModelProperty(value = "主键ID")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "付款ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long paymentId;

    @ApiModelProperty(value = "单据编号")
    private String docNo;

    @ApiModelProperty(value = "支付金额")
    private BigDecimal amount;

    @ApiModelProperty(value = "支付状态 0-待支付 1-支付成功 2-支付失败 3-支付中")
    private Integer status;

    @ApiModelProperty(value = "支付渠道 1-银联 2-微信 3-支付宝")
    private Integer channel;

    @ApiModelProperty(value = "支付流水号")
    private String transactionNo;

    @ApiModelProperty(value = "支付时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    @ApiModelProperty(value = "支付参数")
    private String payParams;

    @ApiModelProperty(value = "支付结果")
    private String payResult;

    // 新增的付款人信息字段
    @ApiModelProperty(value = "付款人")
    private String payerName;

    @ApiModelProperty(value = "付款人账号")
    private String payerAccount;

    @ApiModelProperty(value = "付款人银行")
    private String payerBank;

    // 新增的收款人信息字段
    @ApiModelProperty(value = "收款人")
    private String payeeName;

    @ApiModelProperty(value = "收款人账号")
    private String payeeAccount;

    @ApiModelProperty(value = "收款人银行")
    private String payeeBank;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "是否删除 0-未删除 1-已删除")
    @TableLogic
    private Integer isDel;
}